<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>방추가 - Dormitory</title>
	<link rel="shortcut icon" href="favicon.ico">
	<link rel="stylesheet" href="css/themes/default/jquery.mobile-1.4.3.min.css">
	<link rel="stylesheet" href="_assets/css/jqm-demos.css">
    <link rel="stylesheet" href="css/family.css">
	<script src="js/jquery.js"></script>
	<script src="_assets/js/index.js"></script>
	<script src="js/jquery.mobile-1.4.3.min.js"></script>
	<script src="js/dormitory.js"></script>
	<script>
		var dormitory = new Dormitory();
		
		$(document).ready(function() {
			// 방 추가
			$("#room-new-save").click(function(){
				var name = jQuery.trim($("#room-new-name").val());
				var maxPersonCnt = $("#room-new-max-cnt").val();
				
				if(name == ""){
					alert("방 이름을 입력하세요");
					$("#room-new-name").focus();
					return;
				}
				
				if(maxPersonCnt == ""){
					alert("최대인원을 선택하세요");
					return;
				}
				
				var room = new Room(dormitory.getRoomList().length + 1, name, maxPersonCnt);
				
				dormitory.addRoom(room);
				
				localStorage.setItem("dormitory", JSON.stringify(dormitory));
				
				document.location.href = "room_list.html";
				
			});
		});
	</script>
</head>
<body>
<div data-role="page" class="jqm-demos">

	<div data-role="header" class="jqm-header">
		<h1>방추가</h1>
		<a href="#" class="jqm-navmenu-link ui-btn ui-btn-icon-notext ui-corner-all ui-icon-bars ui-nodisc-icon ui-alt-icon ui-btn-left">Menu</a>
	</div><!-- /header -->

	<div role="main" class="ui-content jqm-content">
		
		<div class="ui-grid-a ui-responsive">
			<input type="text" name="textinput-1" id="room-new-name" placeholder="방이름 입력하세요" value="">
			<div class="ui-field-contain">
			    <select name="select-custom-18" id="room-new-max-cnt" data-native-menu="false">
			    	<option value="">최대인원을 선택하세요</option>
			        <option value="1">1</option>
			        <option value="2">2</option>
			        <option value="3">3</option>
			        <option value="4">4</option>
			        <option value="5">5</option>
			        <option value="6">6</option>
			        <option value="7">7</option>
			        <option value="8">8</option>
			        <option value="9">9</option>
			        <option value="10">10</option>
			    </select>
			</div>
		</div>
		
		<input type="button" value="저장" id="room-new-save">
	
	</div><!-- /content -->
	<div data-role="panel" class="jqm-navmenu-panel" data-position="left" data-display="overlay" data-theme="a">
	  	<ul class="jqm-list ui-alt-icon ui-nodisc-icon">
			<li data-filtertext="demos homepage" data-icon="home"><a href="dashboard.html">Dashboard</a></li>
			<li data-filtertext="buttons button markup buttonmarkup method anchor link button element"><a href="room_list.html" data-ajax="false">방관리</a></li>
			<li data-filtertext="introduction overview getting started"><a href="bed_list.html" data-ajax="false">침대관리</a></li>
			<li data-filtertext="form button widget input button submit reset"><a href="customer_list.html" data-ajax="false">고객관리</a></li>
			<li data-filtertext="form button widget input button submit reset"><a href="book_list.html" data-ajax="false">예약관리</a></li>
			<li data-filtertext="form button widget input button submit reset"><a href="tour_list.html" data-ajax="false">투어관리</a></li>
		</ul>
	</div><!-- /panel -->


	<div data-role="footer" data-position="fixed" data-tap-toggle="false" class="jqm-footer">
		<p>도미토리 version <span class="jqm-version"></span></p>
		<p>Copyright 2014 Riuzzang</p>
	</div><!-- /footer -->
	

</div><!-- /page -->

</body>
</html>
